package testeditor;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import editor.Trame;

public class Cadre1 extends JFrame
{
    private JPanel contentPane;
    private Trame trame = new Trame();
    private JButton jButton1 = new JButton();
    private JPanel jPanel2 = new JPanel();

    //Construire le cadre
    public Cadre1() {
	enableEvents(AWTEvent.WINDOW_EVENT_MASK);
	try {
	    jbInit();
	}
	catch(Exception e) {
	    e.printStackTrace();
	}
	pack();
    }
    //Initialiser le composant
    private void jbInit() throws Exception  {
	//setIconImage(Toolkit.getDefaultToolkit().createImage(Cadre1.class.getResource("[Votre icône]")));
	contentPane = (JPanel) this.getContentPane();
	contentPane.setLayout(null);
	this.getContentPane().setBackground(Color.lightGray);
	this.setForeground(Color.black);
	this.setResizable(false);
	this.setSize(new Dimension(353, 168));
	this.setTitle("Test Editeur Trame");
	trame.setBorder(BorderFactory.createEtchedBorder());
	trame.setBounds(new Rectangle(12, 12, 218, 142));
	contentPane.setBackground(Color.gray);
	contentPane.setPreferredSize(new Dimension(354, 168));
	jButton1.setBackground(new Color(175, 0, 0));
	jButton1.setBounds(new Rectangle(10, 10, 81, 124));
	jButton1.setForeground(Color.white);
	jButton1.setMargin(new Insets(2, 1, 2, 1));
	jButton1.setText("Transmettre");
	jButton1.addActionListener(new java.awt.event.ActionListener() {
	    public void actionPerformed(ActionEvent e) {
		jButton1_actionPerformed(e);
	    }
	});
	jPanel2.setBorder(BorderFactory.createEtchedBorder());
	jPanel2.setBounds(new Rectangle(239, 12, 100, 143));
	jPanel2.setLayout(null);
	contentPane.add(trame, null);
	contentPane.add(jPanel2, null);
	jPanel2.add(jButton1, null);
    }
    //Supplanté, ainsi nous pouvons sortir quand la fenêtre est fermée
    protected void processWindowEvent(WindowEvent e)
    {
	super.processWindowEvent(e);
	if (e.getID() == WindowEvent.WINDOW_CLOSING) {
	    System.exit(0);
	}
    }

    void jButton1_actionPerformed(ActionEvent e)
    {
	trame.dumpTrame();

    }

}